package com.xcalendar.servlets;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.xcalendar.constant.XConstants;
import com.xcalendar.database.table.User;
import com.xcalendar.management.EventManager;
import com.xcalendar.managementImpl.EventManagerImpl;

@SuppressWarnings("serial")
public class DeleteEventController extends HttpServlet {
	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse respose) throws ServletException, IOException {
		HttpSession session = request.getSession();
		User user = (User) session.getAttribute(XConstants.SESSION_USER);
		EventManager eventManager = new EventManagerImpl();
		String eventId = request.getParameter("eventId");
		System.out.println("deleteId:"+eventId);
		eventManager.deleteEvent(eventId);
		respose.setContentType("text/plain");
		respose.getWriter().println("deleteSuccessfully");
	}
}
